I got back from Prelude's corner reviewing his tutorials on "Pointers" and another one on "Structures." I am still stumped on a problem - I'm using the exact statements and format found in Sams "Teach yourself C in 21 days...6th edition" on the section dealing with structures.
I'm using MS VS 2010, which may be part of the problem. Please only address the problem at hand - I could care less if the code below creates local or global variables, etc. I have not completed main() because of an earlier problem.
Here's my simple code:
Code:
// dummy test area to test small snips of C code.
// 8/9/10
//
#include <stdio.h>
struct Part // define a simple structure
{
short number;
char name[10];
};
struct Part *p_part; // declare a pointer to type part
struct Part gizmo; // declare an instance of type part
p_part = &gizmo; // now initialize the pointer
int main(void)
{
(*p_part).number = 100;
return 0;
}
And here is the offending statement per my compiler:
Code:
p_part = &gizmo; // now initialize the pointer
I'm getting "Error: this declaration has no storage class or type specifier."
Grrrr.....
If it needed a storage class of type specifier, the book should have told me
to use one.
Thanks for any help!